package views;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author pelle
 * Stefan: 2010.12.15
 */
public abstract class AbstractView extends javax.swing.JFrame {
    private JFrame frame;

    public void showWarning(String message, String title) {
        JOptionPane.showMessageDialog(frame, message, title, JOptionPane.WARNING_MESSAGE);
    }

    public void showWarning(String message) {
        this.showWarning(message, "Advarsel!");
    }

    public void showError(String message, String title) {
        JOptionPane.showMessageDialog(frame, message, title, JOptionPane.ERROR_MESSAGE);
    }

    public void showError(String message) {
        this.showError(message, "Fejl!");
    }

    public void showMessage(String message, String title) {
        JOptionPane.showMessageDialog(frame, message, title, JOptionPane.INFORMATION_MESSAGE);
    }

    public void showMessage(String message) {
        this.showMessage(message, "Bemærk!");
    }

    public boolean showConfirm(String message, String title) {
        boolean yesno = false;
        int answer = JOptionPane.showConfirmDialog(frame, message, title, JOptionPane.YES_NO_OPTION);
        
        if(answer == 0) {
            yesno = true;
        }

        return yesno;
    }

    public boolean showConfirm(String message) {
        return this.showConfirm(message, "Bekræft handling");
    }
    
}